package org.dstart.air.window.sub.draw
{
	import flash.display.Loader;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.IOErrorEvent;
	import flash.filters.GlowFilter;
	import flash.net.URLRequest;
	import flash.text.TextField;
	import flash.text.TextFormat;

	public class DrawBaseIcon extends Sprite
	{
		private var tColor:uint;
		private var tLoad:Loader;
		
		public function DrawBaseIcon(txtColor:uint = 0x00FF00)
		{
			tColor = txtColor;
			
			tLoad = new Loader();
			tLoad.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadDone);
			tLoad.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onLoadError);
			tLoad.load(new URLRequest("icons/16_16.png"));
		}
		
		private function onLoadDone(e:Event):void
		{
			addChild(tLoad);
		}
		
		private function onLoadError(e:Event):void
		{
			var txt:TextField = new TextField();
			txt.defaultTextFormat = new TextFormat(null, 12, tColor, true);
			txt.text = "DS";
			txt.width = txt.textWidth + 5;
			txt.height = txt.textHeight + 2;
			txt.selectable = false;
			txt.filters = new Array(new GlowFilter(0x000000, 0.8, 1.3, 1.3, 3));
			addChild(txt);
		}		
	}
}